<template>
  <div class="home">
    1111
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="#000">
      <van-swipe-item v-for="items in homeInfo.banner" :key="items.id">
        <img class="img" :src="items.image_url" alt="">
      </van-swipe-item>
    </van-swipe>
    <div v-html="text">

    </div>
    <router-link to="/home/search">搜索</router-link>
    <button @click="goSearch">
      搜索
    </button>
  </div>
</template>

<script>
import { index } from "../api/home";

export default {
  name: "index",
  data(){
    return{
      homeInfo:{},
      text: "<div><p>123</p></div>"
    }
  },
  created() {
    this.indexs();
  },
  mounted() {
  },
  methods:{
    indexs(){
      index().then(res =>{
        console.log(res)
        this.homeInfo = res
      })
    },
    goSearch(){
      this.$router.push("/home/search")
    }
  }
}
</script>

<style lang="scss" scoped>
//::v-deep样式穿透
::v-deep p{
  color: red;
}
.home{
  .img{
    width: 100%;
  }
  ::v-deep .van-swipe__indicator{
    background-color: red;
  }
}
</style>
